﻿using UnityEngine;

namespace UnityBasicGem.Example1
{
	public class Player : MonoBehaviour
	{
		protected float mJumpSpeed = 12.0f;

		public bool Landing = false;

		// Update is called once per frame
		void Update()
		{
			if (this.Landing)
			{

				if (Input.GetMouseButtonDown(0))
				{

					this.Landing = false;
					this.GetComponent<Rigidbody>().velocity = Vector3.up * this.mJumpSpeed;
				}
			}
		}

		void OnCollisionEnter(Collision collision)
		{
			if (collision.gameObject.CompareTag("Floor"))
			{

				this.Landing = true;
			}
		}
	}
}